package com.kly.user.enums;

/**
 * 用户类型: 1-chatter 2-chatter model 3-model  4-app account(普通用户)
 *
 * @author linqu
 */
public enum UserType {
    ALL(0, "all", "all"), // 不表示用户类型，仅过滤数据时作为默认参数条件使用，避免null值

    CHATTER(1, "chatter", "chatter"),

    CHATTER_MODEL(2, "chatter model", "chatter model"),

    MODEL(3, "model", "model"),

    NORMAL_USER(4, "normal account", "normal account"),

    CUSTOMER_SERVICE(5, "customer service", "customer service"),
    ;

    private final int type;

    private final String Value;

    private final String description;

    UserType(int type, String value, String description) {
        this.type = type;
        Value = value;
        this.description = description;
    }

    public int getType() {
        return type;
    }

    public String getValue() {
        return Value;
    }

    public String getDescription() {
        return description;
    }


    public static UserType fromType(int type) {
        for (UserType userStatus : values()) {
            if (userStatus.getType() == type) {
                return userStatus;
            }
        }
        throw new IllegalArgumentException("Invalid login type: " + type);
    }
}
